{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">广告图片</label>
                <div class="layui-input-block">
                    {:get_field('image',isset($data.image)?$data.image:'','image','image')}
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">所属分类</label>
                <div class="layui-input-block">
                    <select name="category">
                        <option value="">请选择所属分类</option>
                        {foreach name=":get_dict_list(14)" key="k" item="v"}
                        <option value="{$v.id}" {if condition="isset($data) and $data.category eq $v.id"}selected="selected"{/if}>{$v.name}</option>
                        {/foreach}
                    </select>
                    <a type="button" class="layui-btn layui-btn-position ajax-iframe" href="{:url('admin/dict/add_data',['dict_id'=>14])}" data-width="400px">添加分类</a>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">广告名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" value="{$data.name|default=''}" autocomplete="off" placeholder="请输入名称" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">跳转URL</label>
                <div class="layui-input-block">
                    <input type="text" name="url" value="{$data.url|default=''}" autocomplete="off" placeholder="" class="layui-input">
                </div>
            </div>
            
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="i" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
